#define _CRT_SECURE_NO_WARNINGS 1
class Solution {
public:
    vector<int> intersection(vector<int>& nums1, vector<int>& nums2)
    {
        vector<int> ret;
        unordered_set<int> unset;
        for (auto& a : nums1)
        {
            unset.insert(a);
        }
        unordered_set<int> unset2;
        for (auto& a : nums2)
        {
            if (unset.find(a) != unset.end())
            {
                unset2.insert(a);
            }
        }
        for (auto& a : unset2)
        {
            ret.push_back(a);
        }
        return ret;
    }
};